
package net.wangds.comp.endpoint.http;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import org.apache.commons.fileupload.FileItem;


public class FormBasedFileUploadRequestForm {

	private List<FileItem> files = new LinkedList<FileItem>();
	
	private Map<String, String> fields = new HashMap<String, String>();
	
	public FormBasedFileUploadRequestForm(){
		
	}
	
	public FormBasedFileUploadRequestForm(Map<String,String> formfields){
		this.fields.putAll(formfields);
	}

	public List<FileItem> getFileItems(){
		return this.files;
	}
	
	public void addFileItems(FileItem item){
		if(item!=null){
			files.add(item);
		}
	}
	
	public void setFileItems(List<FileItem> items){
		this.files.clear();
		this.files.addAll(items);
	}

	public Map<String, String> getFields() {
		return fields;
	}

	public void setFields(Map<String, String> fields) {
		this.fields = fields;
	}
	
}
